package com.hmall.feign.client;

import com.hmall.feign.config.DefaultFeignConfiguration;
import com.hmall.feign.dto.PageDTO;
import com.hmall.feign.dto.RequestParams;
import com.hmall.feign.pojo.Item;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

@FeignClient(value = "itemservice",configuration = DefaultFeignConfiguration.class)
public interface ItemClient {
    @PostMapping("/item/list")
    PageDTO<Item> itemPageInfo(@RequestBody RequestParams params);

    @GetMapping("/item/{id}")
    public Item searchItemById(@PathVariable("id")Long id);

    // 扣减库存
    @PutMapping("/item/stock/{itemId}/{num}")
    public void updateStock(@PathVariable("itemId")Long itemId, @PathVariable("num")Integer num);
}
